#if CONFIG_IIC_DRIVER_TESTER

#ifndef  __IIC_DRIVER_TEST_H__
#define  __IIC_DRIVER_TEST_H__

#ifdef _cplusplus
extern "c"{
#endif

#include "Queue.h"
#include "TransferDriver.h"

/* macro define  */
#define IIC_TXOK_MASK	0x01	//tx success
#define IIC_TXNA_MASK	0x02	//tx no ack
#define IIC_TXBY_MASK	0x04	//tx bus busy
#define IIC_TXBE_MASK	0x08	//tx bus error
#define IIC_RXOK_MASK	0x10	//rx success
#define IIC_RXNA_MASK	0x20	//rx no ack
#define IIC_RXBY_MASK	0x40	//rx bus busy
#define IIC_RXBE_MASK	0x80	//rx bus error

#define IIC_BUF_EMPT	0x01	//buf empty
#define IIC_BUF_FULL	0x02	//buf full


#define MAX_BUS_DATAPACKET	20
#define BUS_DATAPACKET_SIZE	64
#define MAX_BUS_EVENT		64

typedef void (* IicDriverNotifyFun)(uint8 deviceId,uint8 eventInd);
typedef int (* IicDriverCallBackFun)(void* pCallBackObj, TransferEvent eventId, uint8* pData, uint8 len);
typedef struct _BusDataPacket
{
	uint8	m_Data[BUS_DATAPACKET_SIZE];
	uint8	m_Len;
}BusDataPacket;

typedef struct _IicDriver
{
	Transfer	m_Base;
	uint8		m_Channel;

	IicDriverNotifyFun Notify;
	IicDriverCallBackFun CallBack;

	Queue*			m_pRxQueue;
	//BusDataPacket	m_ReceiveDataQueueBuff[MAX_BUS_DATAPACKET];

	Queue*			m_pTxQueue;
	//BusDataPacket	m_SendDataQueueBuff[MAX_BUS_DATAPACKET];

	void*	m_pCallBackObj;
	Queue	m_EventQueue;
	uint32	m_pEventQueueBuff[MAX_BUS_EVENT];
}IicDriver;

void IicDriverTester_Init(IicDriver* pIicDriver, uint8 channel, Queue* pRxQueue, Queue* pTxQueue, IicDriverCallBackFun callBack, void* pCallBackObj);
int IicDriverTester_TxData(IicDriver* pIicDriver, uint8* pData, uint8 len);
void IicDriverTester_Rx(IicDriver* pIicDriver);
int IicDriverTester_TxDataFailed(IicDriver* pIicDriver, uint8* pData, uint8 len);
void IicDriverTester_Reset(IicDriver* pIicDriver);

#ifdef _cplusplus
}
#endif

#endif 

#endif

